package main

import (
	"fmt"
)

//定义接口phone
type Phone interface {
	call()
	callReturn() string
}

//定义结构体 即对象
type NokiaPhone struct {
}

func (nokiaPhone NokiaPhone) callReturn() string {
	return "nokiaPhone"
}

//该对象实现接口方法 call
func (nokiaPhone NokiaPhone) call() {
	fmt.Println("I am Nokia, I can call you!")
}

//定义结构体 即第二种对象
type IPhone struct {
}

func (iPhone IPhone) callReturn() string {
	return "iphone"
}

//该对象实现接口方法 call
func (iPhone IPhone) call() {
	fmt.Println("I am iPhone, I can call you!")
}

//定义结构体 即第3种对象
type IPhone8 struct {
}

//该对象实现接口方法 call
func (iPhone IPhone8) call() {
	fmt.Println("I am iPhone8, I can call you!")
}

func main() {
	var phone Phone

	phone = new(NokiaPhone)
	phone.call()
	callReturn := phone.callReturn()
	fmt.Println("------" + callReturn)

	phone = new(IPhone)
	phone.call()
	s := phone.callReturn()
	fmt.Println("------" + s)

}
